import { Component, OnInit } from '@angular/core';
import {MdDialog, MdDialogRef} from "@angular/material";
import {MenuDesktopComponent} from "../menu-desktop/menu-desktop.component";
import {myValidNull} from "../../../shared/util/string-utils";

@Component({
  selector: 'menu-button',
  template: `
    <div class="home-menu" (click)="openMenus($event)"></div>
  `,
  styles: [`
    .home-menu{width: 65px;height: 65px;position: fixed;bottom: 20px;right: 20px;background: url(../../../../assets/img/menu.png);z-index: 995;}
  `]
})
export class MenuButtonComponent implements OnInit {
  menusRef: MdDialogRef<MenuDesktopComponent>;
  constructor(public dialog: MdDialog,) { }

  ngOnInit() {
  }
  openMenus(e){
      this.menusRef = this.dialog.open(MenuDesktopComponent, {
        disableClose: true,
        width:"100%"
      });
      this.menusRef.afterClosed().subscribe(result => {
        this.menusRef = null;
        console.log(result);
        if(!myValidNull(result)&&result.status){//成功
        }
      });
  }
}
